﻿using BigEgg.Framework.Foundation;
using BigEgg.Framework.UnitTesting;
using FMStudio.Domain.Properties;
using FMStudio.Domain.Test.MockClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;

namespace FMStudio.Domain.Test
{
    [TestClass]
    public class AuditTypeTest
    {
        [TestMethod]
        public void AuditTypeNameValidationTest()
        {
            MockAuditType auditType = new MockAuditType();

            Assert.IsNull(auditType.Name);
            Assert.AreEqual(Resources.AuditTypeNameMandatory, auditType.Validate("Name"));

            auditType.Name = TestHelper.CreateString('A', 99);
            Assert.AreEqual("", auditType.Validate("Name"));
            auditType.Name = TestHelper.CreateString('A', 100);
            Assert.AreEqual("", auditType.Validate("Name"));
            auditType.Name = TestHelper.CreateString('A', 101);
            Assert.AreEqual(
                string.Format(CultureInfo.CurrentCulture, Resources.AuditTypeNameMaxLength, "Name", 100)
                , auditType.Validate("Name"));
        }

        [TestMethod]
        public void AuditTypePayTypeValidationTest()
        {
            MockAuditType AuditType = new MockAuditType();

            Assert.IsNull(AuditType.PayType);
            Assert.AreEqual(Resources.PayTypeMandatory, AuditType.Validate("PayType"));

            MockPayType payType = new MockPayType();
            AuditType.PayType = payType;
            Assert.AreEqual("", AuditType.Validate("PayType"));
        }
    }
}
